#include "debugconsole.h"
#include "ui_debugconsole.h"

DebugConsole::DebugConsole(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DebugConsole)
{
    ui->setupUi(this);
    ui->consoleEdit->setMaximumBlockCount(500);
    ui->consoleEdit->setReadOnly(true);
}

DebugConsole::~DebugConsole()
{
    delete ui;
}

void DebugConsole::log(const QString &text)
{
    ui->consoleEdit->appendPlainText(text);
}

void DebugConsole::error(const QString &text)
{
    ui->consoleEdit->appendPlainText(text);
    if (POPUP_ON_ERROR) this->show();
}

void DebugConsole::on_clearButton_clicked()
{
    ui->consoleEdit->clear();
}
